package Server;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Label;
import java.awt.Panel;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;


public class LoginFrame extends JFrame
{
	private TextField txtUserName;
	private JButton btnOK ;
	private Login lg ;
	
	public LoginFrame()
	{
		initComponent();
	}
	
	private void initComponent()
	{
		this.setBounds(50,20,300,200);
		this.setLayout(new BorderLayout());
		Container c = this.getContentPane();
		
		Panel p = new Panel();
		p.setLayout(new FlowLayout());
		txtUserName = new TextField();
		p.add(txtUserName);
		
		btnOK = new JButton("OK");
		btnOK.addActionListener(new ActionListener()
		{
			@Override
			public void actionPerformed(ActionEvent ae)
			{
				EventQueue.invokeLater(new Runnable()
				{
					public void run()
					{
						lg.send2Server(txtUserName.toString());
					}
				});
			}
		});
		p.add(btnOK);
		c.add(p,BorderLayout.CENTER);
	}
	
	public static void main(String[] args)
	{
		LoginFrame lf = new LoginFrame();
		lf.setVisible(true);
	}
}